var GMQuery = {
	resultArr: null, //查询结果列表-所有
	handler_hcq: null,
	fealayerid: null,
	resultCon: null,
	mapClickevt_zbcx: null,
	strtemp_back: null,
	feature: null,
	gaodePois: null,
	// lab:null,
	//底面高度值
	cehuaH1: 0,
	cehuaH2: 0,
	shortcutsH1: 0,
	shortcutsH2: 0,
	bottomContainerTop1: 0,
	bottomContainerTop2: 0,
	init: function() {
		//条件查询
		window.addEventListener('eventend', function(event) {
			GMQuery.strtemp_back = event.detail.strtemp;
			GMQuery.dtjQuery(MapObj.deepwellUrl);
		});

		var input_search = document.getElementById("input_search");
		//监听点击事件：查询框的确定事件
		input_search.addEventListener("keydown", function(e) {
			if (e && e.keyCode == 13) {
				$("#search").css("display", "block")
				// offCanvasWrapperSecondShow()
				// AllWindowClose()
				$("input").blur();
				resultDisplay = 0;
				$('#cehua').css('display', 'none');
				MapObj.mapClear();
				var showUserPicker_fun = document.getElementById('showUserPicker');

				GMQuery.gjzQuery(MapObj.deepwellUrl);
				// GMQuery.gjzQuery(MapObj.landuseQueryUrl);
			}
		});


		mui("#resultList").on('tap', '.mui-table-view-cell', function() {
			var index = $(this).index();
			let yuandang = '<i class="fa fa-map-marker mui-icon" style="margin-right:5px"></i> 元荡生态岸线贯通工程示范段（青浦）'
			
			if($(this).context.innerHTML == yuandang){
				console.log("进入")
				$(".bar").css("visibility","visible")
			}else{
				$(".bar").css("visibility","hidden")
				console.log("出去")
			}
			if ($('#resulitTitle').text() != "周边查询" && $('#resulitTitle').text() != "兴趣点查询") {
				var res = GMQuery.resultArr;
				var feature = res[index];

				var polygon = res[index].geometry;
				GMQuery.showInfowindow(feature);
				GMQuery.zoomToPolygon(polygon);
				$("#bottomContainer").on("tap",function(){
					GMQuery.closeBottomWindow();
				})
				// MAP.on("click", GMQuery.closeBottomWindow())
			} else if ($('#resulitTitle').text() == "兴趣点查询") {
				var gaodePois = GMQuery.gaodePois;
				var gaodePoi = gaodePois[index];
				GMQuery.showGaodePoisInfowindowAndLocation(gaodePoi);
			} else {
				var res = GMQuery.resultArr;
				var feature = res[index];
				var polygon = res[index].geometry;
				GMQuery.showInfowindow_poi(feature);
				GMQuery.zoomToPOI(polygon);
				var gra = MapObj.symbolgraphicLayer.graphics[index];
				var symbol = new esri.symbol.PictureMarkerSymbol({
					"url": "img/search/redstar.png",
					"width": 16,
					"height": 16,
					"yoffset": 16
				});
				gra.setSymbol(symbol);
				
			}
			bottomContainerHide();
		});


		mui("#attachmentResultList").on('tap', '.mui-table-view-cell', function() {
			var index = $(this).index();
			//chrli 打开pdf
			//offCanvasWrapperHide();
			//openFile('https://file-shsmijc.oss-cn-shanghai.aliyuncs.com/test.pdf');
			//launchApp();
			var id = "html/pdfPreview.html";
			var href = "html/pdfPreview.html";
			var title = "附件预览";
			openNewWindow(id, href, title, '');
		});

		var detailInfoHref_ele = document.getElementById("detailInfoHref");
		detailInfoHref_ele.addEventListener("tap", function() {
			GMQuery.OpenDetailInfoWindow()
		});

		// var opcWinHref_ele = document.getElementById("opcWinHref");
		// opcWinHref_ele.addEventListener("tap", function() {
		// 	GMQuery.OpenOpcDetailInfoWindow()
		// });

		//		var attachmentWinHref_ele = document.getElementById("attachmentWinHref");
		//		attachmentWinHref_ele.addEventListener("tap", function() {
		//			GMQuery.OpenPdfWindow()
		//		});

		var pictureWinHref_ele = document.getElementById("pictureWinHref");
		pictureWinHref_ele.addEventListener("tap", function() {
			GMQuery.OpenPictureWindow()
		});

		function openFile(url) {
			//创建一个下载任务
			var dtask = plus.downloader.createDownload(url, {}, function(d, status) {
				if (status == 200) {
					var fileUrl = d.filename;
					plus.runtime.openFile(fileUrl, {}, function(e) {
						alert('打开失败');
					});
				} else {
					alert("Download failed: " + status);
				}
			});
			dtask.start();
		}

		function launchApp() {
			if (plus.os.name == "Android") {
				//				plus.runtime.launchApplication({
				//					pname: "com.android.browser",
				//					extra: {
				//						url: "https://file-shsmijc.oss-cn-shanghai.aliyuncs.com/test.pdf"
				//					}
				//				}, function(e) {
				//					alert("Open system default browser failed: " + e.message);
				//				});
				var id = "html/pdfPreview.html";
				var href = "html/pdfPreview.html";
				var title = "附件预览";
				openNewWindow(id, href, title, "");
			} else if (plus.os.name == "iOS") {
				plus.runtime.launchApplication({
					action: "https://file-shsmijc.oss-cn-shanghai.aliyuncs.com/test.pdf"
				}, function(e) {
					alert("Open system default browser failed: " + e.message);
				});
			}
		}
	},

	initFindparams: function(url) {
		var gmfindParams = new esri.tasks.FindParameters();
		gmfindParams.returnGeometry = true;
		gmfindParams.layerIds = [1];
		gmfindParams.searchFields = ["land_use_trial", "land_use_name"];
		gmfindParams.outFields = ["*"];
		return gmfindParams;
	},

	initClosePopupevent: function() {
		var infowindow_ele = document.getElementsByClassName("titleButton close");
		infowindow_ele[0].addEventListener("tap", function() {
			map.infoWindow.hide();
		});
	},

	//查询到结果(find语句)后，组成resultArr
	configFindResultArray: function(results) {
		var temp = new Array();
		if (results == "" || results.length == 0) {
			return temp;
		}

		for (var i = 0; i < results.length; i++) {
			temp.push(results[i]);
		}
		GMQuery.resultArr = temp;
	},

	//查询到结果(query语句)后，组成resultArr
	configResultArray: function(results) {
		if (results == "" || results.length == 0) {
			mui.alert("抱歉，没有搜索到记录", "提示");
			return;
		}
		//chrli 解决查询到的属性字段大小写不一致问题
		for (var i = 0; i < results.features.length; i++) {
			GMQuery.resultArr.push(results.features[i]);
		}
	},
	configResultList: function(res) {
		var content = "";
		var htmlstr = "";
		var aream = 0.0;
		var resultList = document.getElementById('resultList');
		console.log($("#detailed"))
		console.log(res, "数据大全")
		for (var i = 0; i < res.length; i++) {
			content = "<li>" + res[i].properties.概况 + "</li>"
			window.content = content

			//查出的属性字段有时大写 有时小写
			//			if(res[i].properties.水表编号) {
			//				var temp = res[i].properties.水表编号;
			//
			//			} else if(res[i].properties.sbbh) {
			//				var temp = res[i].properties.sbbh;
			//			}
			//			
			if (res[i].properties.项目名) {
				var temp = res[i].properties.项目名
				// console.log(temp,"92123")
				// $(".bar").css("display","block")
				// if(temp == "元荡生态岸线贯通工程示范段（青浦）"){
				// 	$(".bar").css("display","block")
				// }else{
				// 	$(".bar").css("display","none")
				// }

			} else if (res[i].properties.编号) {
				var temp = res[i].properties.编号;
			}
			

			//			"<span style='float:right'></span>"
			htmlstr +=
				"<li  class='mui-table-view-cell' style='color: #515151;'><i class='fa fa-map-marker mui-icon' style='margin-right:5px'></i> " +
				temp + "</li>";
			//			aream += parseFloat(res[i].properties.地块面积 || res[i].properties.land_area);

		}

		//		document.getElementById('sumInstru').innerHTML = '共查得地块 ' + res.length + ' 个<br/>合计面积 ' + parseFloat(aream * 3 / 2000).toFixed(2) + ' 亩';
		document.getElementById('sumInstru').innerHTML = '共 ' + res.length + ' 条记录 ';

		$('#sumInstru').css('line-height', '20px');
		resultList.innerHTML = htmlstr;
	},

	showGaodePois: function(res) {
		var htmlstr = "";
		var resultList = document.getElementById('resultList');
		for (var i = 0; i < res.length; i++) {
			//查出的属性字段有时大写 有时小写
			if (res[i].name) {
				//var temp = res[i].name + "(" + res[i].address + ")"
				var temp = res[i].name
			}
			htmlstr +=
				"<li  class='mui-table-view-cell' style='color: #515151;'><i class='fa fa-map-marker mui-icon' style='margin-right:5px'></i>" +
				temp + "</li>";
		}
		document.getElementById('sumInstru').innerHTML = '共查得 ' + res.length + ' 条地址数据 ';
		$('#cehua').css('display', 'block');
		$('#sumInstru').css('line-height', '20px');
		resultList.innerHTML = htmlstr;
	},
	showWin: function() {
		AllWindowClose();
		openResultWin();
	},

	dtjQuery: function(url) {
		GMQuery.resultArr = [];
		var str = GMQuery.strtemp_back;
		if (str != '') {
			//定义查询参数对象
			var query = L.esri.query({
				// url: url + '/1',
				url: url + '/1'
			});
			query.where(str);
			query.run(function(error, featureCollection, response) {
				if (!featureCollection.features || featureCollection.features.length == 0) {
					mui.alert("抱歉，没有搜索到记录", "提示");
				} else {
					resultDisplay = 1;
					$('#cehua').css('display', 'block');
					//属性字段名称小写
					GMQuery.configResultArray(featureCollection);
					console.log(GMQuery.configResultArray(featureCollection), "7777777777")
					GMQuery.configResultList(GMQuery.resultArr);
					//展示结果
					setResultTitle("dtj");
					GMQuery.showWin();
					offCanvasWrapperShow();

				}
			})
		}
	},

	//关键字查询
	gjzQuery: function(url) {
		GMQuery.resultArr = [];
		var searchtxt = document.getElementById('input_search').value;
		var find = L.esri.find({
			url: url
		});
		find.layers([0]).fields(['项目名', '编号 ', '位置', '项目领 ']).text(searchtxt);
		find.run(function(error, featureCollection, response) {
			console.log(response, featureCollection, featureCollection.features,error, "结果")
			if (featureCollection.features.length > 0) {
				window.lab = true;
				resultDisplay = 1;
				// $('#cehua').css('display', 'block');
				GMQuery.configFindResultArray(featureCollection.features);
				GMQuery.configResultList(GMQuery.resultArr);
				GMQuery.showWin();
				setResultTitle("gjz");
				$('#cehua').css('display', 'block');
				offCanvasWrapperSecondShow();
			} else {
				window.lab = false;
				$('#cehua').css('display', 'block');
				GMQuery.closeBottomWindow();
				console.log("高德")
				//调用高德地图poi接口
				var gaodeQueryUrl = 'https://restapi.amap.com/v3/place/text?key=5ee4c9a2f2224e3264c8a8e905161764&keywords=' +
					searchtxt + '&types=&city=上海&children=1&offset=20&page=1'
					// &extensions=all
				// var gaodeQueryUrl ="https://restapi.amap.com/v3/geocode/geo?address=%E5%8C%97%E4%BA%AC%E5%B8%82%E6%9C%9D%E9%98%B3%E5%8C%BA%E9%98%9C%E9%80%9A%E4%B8%9C%E5%A4%A7%E8%A1%976%E5%8F%B7&output=XML&key=5ee4c9a2f2224e3264c8a8e905161764"
	
				mui.ajax(gaodeQueryUrl, {
					dataType: 'json', //服务器返回json格式数据
					type: 'get', //HTTP请求类型
					timeout: 10000, //超时时间设置为10秒；
					headers: {
						'Content-Type': 'application/json'
					},
					success: function(data) {
						console.log(data, "成功")
						if (data.status == '1') {
							if (data.pois.length > 0) {
								resultDisplay = 1;
								$('#cehua').css('display', 'block');
								GMQuery.gaodePois = data.pois;
								GMQuery.showGaodePois(data.pois);
								GMQuery.showWin();
								setResultTitle("pois");
								offCanvasWrapperSecondShow();
							} else {
								console.log("失败");
								mui.alert("抱歉，没有搜索到数据", "提示");
								return;
							}
							// console.log(JSON.stringify(data.pois))

						} else {
							mui.alert("抱歉，没有搜索到数据", "提示");
							return;
						}
					},
					error: function(xhr, type, errorThrown) {
						1 == 1
					}
				});
			}
		})
	},
	newP: function(pt) {
		var xx = pt.x;
		var yy = pt.y;
		var rr = parseFloat(10) * lengthConverParam; //10米范围内
		//parseFloat(10)*Math.sqrt(0.0000261)/500

		var polygonJson = {
			"rings": [
				[
					[xx + rr, yy + rr],
					[xx + rr, yy - rr],
					[xx - rr, yy - rr],
					[xx - rr, yy + rr],
					[xx + rr, yy + rr]
				]
			],
			"spatialReference": {
				"wkid": 4326
			}
		};
		var polygon = new esri.geometry.Polygon(polygonJson);
		return polygon;
	},
	getbuffer: function(dkpoint) {
		//构建缓冲区
		var symbol = new esri.symbol.SimpleMarkerSymbol();
		var params = new esri.tasks.BufferParameters();
		// 缓冲区距离转换
		var hcqd = document.getElementById('hcqdist').value;
		if (hcqd != '') {
			params.distances = [parseFloat(hcqd) * lengthConverParam];
			params.unit = esri.tasks.BufferParameters.UNIT_METER;
			params.bufferSpatialReference = map.spatialReference;
			params.outSpatialReference = map.spatialReference;
			params.geometries = [dkpoint];

			GMQuery.resultCon = '查询条件:地块周边' + hcqd + '米范围内的:';
			var deferred = geoService.buffer(params, function(bufferedGeometries) {
				GMQuery.showBuffer(bufferedGeometries, dkpoint);

			}, function(error) {
				mui.alert(error, "提示");
			});
		} else {
			mui.alert('请输入搜索范围', "提示");
		}
	},

	showBuffer: function(graphics, pt) {
		map.graphics.clear();
		var graphic = new esri.Graphic(graphics[0], fillSymbol);
		map.graphics.add(graphic);
		GMQuery.hcqQuery(graphic.geometry, pt);
	},

	hcqQuery: function(geometry, pt) {
		var queryurl;
		//列出要查找的兴趣点类型
		var arr = GMQuery.POITypeFilter();
		var sqlwhere = '';
		if (arr.length < 1) {
			mui.alert('请选择兴趣点类型！', "提示");
			return;
		} else {
			sqlwhere = 'where=('
			for (var i = 0; i < arr.length; i++) {
				if (i == 0) {
					sqlwhere += 'RANK like \'' + arr[i] + '\'';
				} else {
					sqlwhere += 'OR RANK like \'' + arr[i] + '\'';
				}
			}
			sqlwhere += ')';
		}
		queryurl = gmPOIUrl + '/0/' + 'query?geometryType=esriGeometryPolygon&outFields=*&returnGeometry=true&f=pjson';
		queryurl = queryurl + '&' + GMQuery.getRing2String(geometry);
		queryurl = queryurl + '&' + sqlwhere;
		$.get(queryurl, function(res) {
			GMQuery.parseResult_HCQ(res, pt);
		}, 'json')

	},

	POITypeFilter: function() {
		var groupCheckbox = $("input[name='hcqpoi_chkbox']");
		var pois = '';
		var poiArr = [];
		for (i = 0; i < groupCheckbox.length; i++) {
			if (groupCheckbox[i].checked) {
				GMQuery.resultCon += groupCheckbox[i].nextSibling.nodeValue.trim() + ',';
				if (pois == '') {
					pois += groupCheckbox[i].value;
				} else {
					pois += ',' + groupCheckbox[i].value;

				}
			}
		}
		poiArr = pois.split(',');
		if (poiArr.length > 0) {
			for (var i = 0; i < poiArr.length; i++) {
				var filteri = poiArr[i]; //比较字符串 
				if (filteri.substring(2) == "0000") { //第二级poi
					poiArr[i] = filteri.substring(0, 2) + '%%%%';
				} else if (filteri.substring(4) == "00") { //第三级poi
					poiArr[i] = filteri.substring(0, 4) + '%%';
				}
			}
		}
		//document.getElementById('poires_tbl_con').innerHTML = GMQuery.resultCon+'<br>';
		return poiArr;
	},

	getRing2String: function(graphicRing) {
		var len = graphicRing.rings[0].length;
		var i = 0;
		var step = Math.floor(len / 10); //10个点
		if (step < 1) {
			step = 1;
		}
		var str = 'geometry={"rings":[[';
		for (i = 0; i < len; i += step) {
			str += '[' + graphicRing.rings[0][i].toString() + '],';
		}
		str += '[' + graphicRing.rings[0][0] + ']]]}';
		return str;

	},

	parseResult_HCQ: function(results, pt) {
		GMQuery.resultArr = [];
		if (results == "" || results.features.length == 0) {
			mui.alert("抱歉，没有搜索到兴趣点?", "提示");
			offCanvasWrapperHide();
			MapObj.mapClear();
			return;
		}
		GMQuery.configResultArray(results);
		GMQuery.showgraphic_poi(GMQuery.resultArr, pt);
		GMQuery.Append2tbl_poi(GMQuery.resultArr);
		GMQuery.showWin();
		setResultTitle("zb");
		resultDisplay = 1;
		$('#cehua').css('display', 'block');
		//offCanvasWrapperShow();
	},

	showgraphic_poi: function(results, pt) {
		MapObj.symbolgraphicLayer.clear();
		MapObj.dkgraphicLayer.clear();
		/* var extXmin,extYmin,extXmax,extYmax; */

		var feature;
		var resultArr = [];
		for (var i = 0; i < results.length; i++) {
			//要素放入数组
			feature = results[i];
			//图上绘制
			var sGeometry = feature.geometry;
			var symbol = new esri.symbol.SimpleFillSymbol(
				esri.symbol.SimpleFillSymbol.STYLE_SOLID,
				new esri.symbol.SimpleLineSymbol(
					esri.symbol.SimpleLineSymbol.STYLE_DASHDOT,
					new dojo.Color([255, 0, 0]),
					2
				),
				new dojo.Color([255, 255, 0, 0.25])
			);

			var graphic = new esri.Graphic(sGeometry, symbol);
			MapObj.dkgraphicLayer.add(graphic); // 将绘图加入到图层中
			//在地块上做标记
			var xx = sGeometry.x;
			var yy = sGeometry.y;
			var point = new esri.geometry.Point(xx, yy, MapObj.spatialReference);
			var symbol = new esri.symbol.PictureMarkerSymbol({
				"url": "img/search/goldstar.png",
				"width": 16,
				"height": 16,
				"yoffset": 16
			});
			MapObj.symbolgraphicLayer.add(new esri.Graphic(point, symbol, sGeometry));

		}
		var symbol = new esri.symbol.PictureMarkerSymbol({
			"url": "img/search/pointer.png",
			"width": 32,
			"height": 32,
			"yoffset": 16
		});
		MapObj.symbolgraphicLayer.add(new esri.Graphic(pt, symbol, sGeometry));

	},

	configAttachementWin: function() {
		var htmlstr = "";
		var attachmentResultList = document.getElementById('attachmentResultList');
		htmlstr += "<li  class='mui-table-view-cell' style='color: #515151; '><i class='fa fa-file-o mui-icon'></i>&nbsp;" +
			'示例pdf文件' + "</li>";
		document.getElementById('attachmentSumInstru').innerHTML = '共有附件 ' + '1' + ' 个';
		$('#attachmentSumInstru').css('line-height', '40px');
		attachmentResultList.innerHTML = htmlstr;
		openAttachementWin();
	},

	Append2tbl_poi: function(res) {
		var htmlstr = "";
		var resultList = document.getElementById('resultList');
		for (var i = 0; i < res.length; i++) {
			var temp = GMPOI_obj[res[i].attributes.RANK] + ":" + res[i].attributes.NAME;
			htmlstr += "<li  class='mui-table-view-cell' style='color: #515151; '><i class='fa fa-list mui-icon'></i>&nbsp;" +
				temp + "</li>";
		}
		document.getElementById('sumInstru').innerHTML = '共查得兴趣点 ' + res.length + ' 个';
		$('#sumInstru').css('line-height', '40px');
		resultList.innerHTML = htmlstr;
		mui(".mui-scroll").scroll().scroll().scrollTo(0, 1000, 10)
		//		.scroll().scrollTo(0,1000,10)
		mui('.mui-scroll-wrapper').scroll();
	},

	zoomToPolygon: function(geometry) {
		if (geometry.type == 'Polygon') {
			var centerPoint = L.polygon(geometry.coordinates).getBounds().getCenter(); //获取多边形中心点
			MAP.setView([centerPoint.lng, centerPoint.lat], 16);

		} else if (geometry.type == 'Point') {
			MAP.setView([geometry.coordinates[1], geometry.coordinates[0]], 16);
		}
	},
	showInfowindow: function(feature) {
		var sGeometry = feature.geometry;
		var identifyIcon = L.icon({
			iconUrl: 'img/drop.svg',
			iconSize: [32, 32],
			iconAnchor: [16, 28]
		});
		if (GMIdentify.identifiedMarker) {
			MAP.removeLayer(GMIdentify.identifiedMarker);
		}
		if (sGeometry.type == 'Polygon') {
			var centerPoint = L.polygon(sGeometry.coordinates).getBounds().getCenter(); //获取多边形中心点
			if (GMIdentify.identifiedGraphicLayer) {
				MAP.removeLayer(GMIdentify.identifiedGraphicLayer);
			}
			GMIdentify.identifiedGraphicLayer = L.geoJSON(feature).addTo(MAP);
			GMIdentify.identifiedMarker = L.marker([centerPoint.lng, centerPoint.lat], {
				icon: identifyIcon
			}).addTo(MAP);

		} else if (sGeometry.type == 'Point') {
			var centerPoint = feature;
			if (GMIdentify.identifiedGraphicLayer) {
				MAP.removeLayer(GMIdentify.identifiedGraphicLayer);
			}
			GMIdentify.identifiedMarker = L.marker([centerPoint.geometry.coordinates[1], centerPoint.geometry.coordinates[0]], {
				icon: identifyIcon
			}).addTo(MAP);
		}

		GMQuery.feature = feature;
		// window.feature = GMQuery.feature
		// console.log(JSON.stringify(window.feature))
		// console.log(JSON.stringify(GMQuery))
		//通过feature赋值
		// var infoTitle = feature.properties['水表编号'] || feature.properties['sbbh']
		// var qsdz = feature.properties['取水地址'] || feature.properties['qsdz']
		// var yhm = feature.properties['用户名'] || feature.properties['yhm']

		var infoTitle = feature.properties.objectid || feature.id
		var qsdz = feature.properties.项目名 || feature.properties.QSDWMC
		var num = feature.properties.编号 || feature.properties.TBBH
		var type = feature.properties.项目领 || feature.properties.DLMC

		// var jingdu2 = feature.geometry.coordinates[0][0][0]
		window.feature = feature

		// var weidu2 = feature.geometry.coordinates[0][0][1]
		// if(window.flag == true){
		// 	var jingdu = window.feature.geometry.coordinates[0]

		// 	var weidu = window.feature.geometry.coordinates[1] 
		// } else if (window.show == true) {
		// 	var jingdu = window.feature.geometry.coordinates[0][0][0]

		// 	var weidu = window.feature.geometry.coordinates[0][0][1]
		// }
		// var yhm = feature.properties['用户名'] || feature.properties['yhm']
		//		var landArea = feature.properties['地块面积'] || feature.properties['land_area']
		// $("#offCanvasWrapper").on('click',':not(#bottomContainer)',function(){
		//            $('#bottomContainer').css("display","none");
		//         })
		$('#bottomContainerBtn').removeClass('displayNone');
		$('#detailInfoTitle').html("名称:" + qsdz);
		$('#detailInfoContent').html("ID:" + infoTitle + '\xa0\xa0\xa0\xa0\xa0\xa0' + "编号:" + num + '\xa0\xa0\xa0' +
			"<br/>" + "类型:" + type);
		$('#cehua').css("margin-top", GMQuery.cehuaH2.toString() + "px");
		$('#bottomBar_left').css("margin-top", GMQuery.shortcutsH2.toString() + "px");
		$('#bottomContainer').css("margin-top", GMQuery.bottomContainerTop2.toString() + "px");
	},

	showGaodePoisInfowindowAndLocation: function(feature) {
		var lat = feature.location.split(',')[0];
		var lng = feature.location.split(',')[1];

		var identifyIcon = L.icon({
			iconUrl: 'img/drop.svg',
			iconSize: [32, 32],
			iconAnchor: [16, 28]
		});
		if (GMIdentify.identifiedMarker) {
			MAP.removeLayer(GMIdentify.identifiedMarker);
		}
		GMIdentify.identifiedMarker = L.marker([lng, lat], {
			icon: identifyIcon
		}).addTo(MAP);
		MAP.setView([lng, lat], 16);
		GMQuery.feature = feature
		var infoTitle = feature.name;
		var infoContent = feature.cityname + feature.adname + feature.address + "<br/><span style='color:grey'>" + feature.type
			.split(';')[2] + "</span><br/><span style='color:grey'>" + feature.tel + "</span>"
		$('#bottomContainerBtn').remove('displayNone');
		$('#detailInfoTitle').html(infoTitle);
		$('#detailInfoContent').html(infoContent);
		$('#cehua').css("margin-top", GMQuery.cehuaH2.toString() + "px");
		$('#bottomBar_left').css("margin-top", GMQuery.shortcutsH2.toString() + "px");
		$('#bottomContainer').css("margin-top", GMQuery.bottomContainerTop2.toString() + "px");
	},
	closeBottomWindow: function() {
		$('#cehua').css("margin-top", GMQuery.cehuaH1.toString() + "px");
		$('#bottomBar_left').css("margin-top", GMQuery.shortcutsH1.toString() + "px");
		$('#bottomContainer').css("margin-top", GMQuery.bottomContainerTop1.toString() + "px");
	},
	OpenDetailInfoWindow: function() {
		var id = "html/detailInfo.html";
		var href = "html/detailInfo.html";
		var title = "详细信息";
		// var result = "sss";
		// console.log(result, "*****")
		openNewWindow(id, href,title, GMQuery.feature );
	},

	OpenOpcDetailInfoWindow: function() {
		var id = "html/opcDetailInfo.html";
		var href = "html/opcDetailInfo.html";
		var title = "监测设备状态";
		openNewWindow(id, href, title, GMQuery.feature);
	},

	OpenPictureWindow: function() {
		// 先打开巡查历史
		var id = "pictureHistory";
		var href = "html/pictureHistory.html";
		var title = "巡查信息";
		// 带上用户信息
		openNewWindow(id, href, title, {
			feature: GMQuery.feature,
			userInfo: userInfo,
			locationInfo: {
				currentLon: MapObj.currentLon,
				currentLat: MapObj.currentLat
			}
		});
	},

	OpenPdfWindow: function() {
		AllWindowClose();
		GMQuery.configAttachementWin();
		offCanvasWrapperShow();
	},

	//清除地图
	clear: function() {
		GMQuery.closeBottomWindow();
		if (GMIdentify.identifiedGraphicLayer) {
			MAP.removeLayer(GMIdentify.identifiedGraphicLayer);
		}
		if (GMIdentify.identifiedMarker) {
			MAP.removeLayer(GMIdentify.identifiedMarker);
		}
		//		MapObj.symbolgraphicLayer.clear();
		//		MapObj.dkgraphicLayer.clear();
		//		map.infoWindow.hide();
		//		if(typeof(fealayerid) != 'undefined') {
		//			map.removeLayer(fealayerid);
		//		}
		//		if(typeof(handler_hcq) != 'undefined') {
		//			dojo.disconnect(handler_hcq);
		//		}
	},

	//周边查询的list点击功能
	showInfowindow_poi: function(feature) {
		var sGeometry = feature.geometry; //获取图形
		var cPoint = new esri.geometry.Point();
		cPoint.x = sGeometry.x;
		cPoint.y = sGeometry.y;
		$(".esriPopup .contentPane").attr("style", "max-height:400px;line-height:17px;padding:0px 10px;");
		map.infoWindow.resize(200, 200);
		map.infoWindow.setTitle(feature.attributes.NAME);
		map.infoWindow.setContent("<span>类型:</span>" +
			GMPOI_obj[feature.attributes.RANK] +
			"<br>" +
			"<span>地址:</span>" +
			feature.attributes.ADDRESS
		);
		map.infoWindow.set('anchor', 'top');
		map.infoWindow.show(cPoint);
		map.infoWindow.resize();
		GMQuery.initClosePopupevent();
	},

	zoomToPOI: function(geometry) {
		map.setLevel(13);
		setTimeout(function() {
			map.centerAt(geometry);
		}, 300);
	}
};
